package com.qianfeng.satellitemenudemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.ext.SatelliteMenu;
import android.view.ext.SatelliteMenuItem;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private SatelliteMenu she;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        she = (SatelliteMenu) findViewById(R.id.she);//找到控件
        List<SatelliteMenuItem> items = new ArrayList<>();
        items.add(new SatelliteMenuItem(6, R.mipmap.ic_1));//int id 用于区别是哪一个 具体的item
        items.add(new SatelliteMenuItem(5, R.mipmap.ic_3));
        items.add(new SatelliteMenuItem(4, R.mipmap.ic_4));
        items.add(new SatelliteMenuItem(3, R.mipmap.ic_5));
        items.add(new SatelliteMenuItem(2, R.mipmap.ic_6));
        items.add(new SatelliteMenuItem(1, R.mipmap.ic_2));
        she.addItems(items);

        she.setMainImage(R.mipmap.ic_launcher);
        she.setOnItemClickedListener(new SatelliteMenu.SateliteClickedListener() {
            @Override
            public void eventOccured(int id) {
                Log.e("自定义标签", "eventOccured() called with: " + "id = [" + id + "]");
            }
        });
    }
}
